﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace Sissonix.ExtRest.Exception
{
    /// <summary>
    /// See http://blog.gurock.com/articles/creating-custom-exceptions-in-dotnet/
    /// for neat description of custom exception classes.
    /// </summary>
    [Serializable]
    public class RestException : System.Exception
    {
        HttpMethods.Method Method {get; set;}
        Uri Url { get; set; }

        public override string Message
        {
            get
            {
                return "Unhandled ExtRest exception.";
            }
        }

        public RestException(HttpRequest request)
        {
            this.Method = HttpMethods.ParseHttpMethodType(request.RequestType);
            this.Url = request.Url;
        }

        public RestException(string message) : base(message)
        {
        }

        public RestException(string message,System.Exception innerException): base(message, innerException)
        {
        }
    }
}
